<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">Search Github Users</h3>
    <div>
      <input
        type="text"
        placeholder="enter the name you search"
        v-model="username"
      />&nbsp;<button @click="search">Search</button>
    </div>
  </section>
</template>

<script>
export default {
  data() {
    return {
      username: "",
    };
  },
  methods: {
    search() {
      if (!this.username) {
        alert("请输入要搜索的用户");
        return;
      }

      this.$bus.$emit("search", this.username);
    },
  },
};
</script>

<style></style>
